// Aufgabe_10_1_ Smileys_mit_Kulleraugen

var smiley01;
var smiley02;
var smiley03;
var smiley04;

function setup(){
  createCanvas(550, 550);
  smiley01 = new Smiley(150, 150, 35, 55, 35, 55);
  smiley02 = new Smiley(400, 150, 35, 28, 45, 28);
  smiley03 = new Smiley(150, 400, 30, 40, 30, 40);
  smiley04 = new Smiley(400, 400, 45, 55, 35, 55);
}

function draw(){
  background(0);
  smiley01.display();
  smiley02.display();
  smiley03.display();
  smiley04.display();
}

// Konstruktor
function Smiley(tempX, tempY, tempXAR, tempYAR, tempXAL, tempYAL){

  // Variablen für den Kopf
  this.x = tempX;
  this.y = tempY;

  // Variablen für die Augen
  this.xar = tempXAR;
  this.yar = tempYAR;
  this.xal = tempXAL;
  this.yal = tempYAL;

  // Methode
  this.display = function(){

  // Kopf
  stroke(0);
  strokeWeight(2);
  fill(255, 255, 0);
  ellipse(this.x, this.y, 200, 200);

  // Augäpfel
  fill(255);
  ellipse(this.x+40, this.y-40, 50, 60);
  ellipse(this.x-40, this.y-40, 50, 60);

  // Pupillen
  stroke(0);
  strokeWeight(25);
  point(this.x+this.xar, this.y-this.yar);
  point(this.x-this.xal, this.y-this.yal);

  // Mund
  noFill();
  strokeWeight(6);
  arc(this.x, this.y+30, 80, 60, PI/8, 7*PI/8);
  }
}
